package com.songlanyun.modules.account.entity;

import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.songlanyun.common.drive.RootEntity;
import com.songlanyun.common.enums.MemberConstant;
import com.songlanyun.common.validator.group.AddGroup;
import com.songlanyun.common.validator.group.UpdateGroup;
import lombok.Data;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;

/**
 * 会员在第三方平台中的身份（如果在小程序中的openid）
 *
 * @author Mark
 * @email sunlightcs@gmail.com
 * @date 2020-11-04 10:36:59
 */
@Data
@TableName("yxt_user_third_identity")
public class UserThirdIdentityEntity extends RootEntity<Long, AccountEntity> implements Serializable {
    private static final long serialVersionUID = 1L;

    /**
     *
     */
    @TableId
    private Long id;
    /**
     * identity_code(如果是微信就是open_id的值，其它也是)
     */
    @NotBlank(message = "唯一标识不能为空", groups = {AddGroup.class})
    private String identityCode;
    /**
     * 第三方身份（微信小程序0，支付宝小程序1）
     */
    @NotNull(message = "第三方身份类型不能为空", groups = {AddGroup.class, UpdateGroup.class})
    private MemberConstant.ThirdType thirdType;
    /**
     *
     */
    private Long userId;

    @Override
    public Long getIdentity() {
        return id;
    }
}
